using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Backend.JYD.Model.Task;

namespace Backend.JYD.EFDAL.Mapping
{
    public class TaskPropertyInfoMap : EntityTypeConfiguration<TaskPropertyInfo>
    {
        public TaskPropertyInfoMap()
        {
            // Primary Key
            this.HasKey(t => new { t.TaskPropertyId });

            // Properties
            this.Property(t => t.TaskPropertyId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.StepPropertyId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.TaskDetaillId)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.PropertyValue1)
                .HasMaxLength(500);

            this.Property(t => t.PropertyValue2)
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("TaskPropertyInfo");
            this.Property(t => t.TaskPropertyId).HasColumnName("TaskPropertyId");
            this.Property(t => t.StepPropertyId).HasColumnName("StepPropertyId");
            this.Property(t => t.TaskDetaillId).HasColumnName("TaskDetaillId");
            this.Property(t => t.PropertyValue1).HasColumnName("PropertyValue1");
            this.Property(t => t.PropertyValue2).HasColumnName("PropertyValue2");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");
        }
    }
}
